﻿<Window x:Class="SshCommander.General"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:coll="clr-namespace:System.Collections;assembly=mscorlib"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    Title="SSH Commander" Height="580" Width="1000" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Background="{StaticResource NormalBrush}" >
    <Window.Resources>
        <ObjectDataProvider x:Key="ServeursList"/>
        <DataTemplate x:Key="ServeurCellTemplate">
            <TextBlock Name="ServeurTextBlock" Width="110" Margin="10,0,0,0" TextAlignment="Left" Text="{Binding Path=name}" />
        </DataTemplate>
        <DataTemplate x:Key="LoginCellTemplate">
            <!--<TextBlock Name="LoginTextBlock" Width="70" Margin="10,0,0,0" TextAlignment="Left" Text="{Binding Path=login}" />-->
        </DataTemplate>
        <DataTemplate x:Key="CommandCellTemplate">
            <!--<TextBlock Name="CommandTextBlock" Width="70" Margin="10,0,0,0" TextAlignment="Left" Text="{Binding Path=command}" />-->
        </DataTemplate>
        <DataTemplate x:Key="StatutCellTemplate">
            <TextBlock Name="StatutTextBlock" Width="80" TextAlignment="Center" HorizontalAlignment="Center" Text="{Binding Path=teststatut}" />
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="OK">
                    <Setter TargetName="StatutTextBlock" Property="Foreground" Value="Green"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="KO">
                    <Setter TargetName="StatutTextBlock" Property="Foreground" Value="Red"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="ARecetter">
                    <Setter TargetName="StatutTextBlock" Property="Foreground" Value="Blue"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="EnCours">
                    <Setter TargetName="StatutTextBlock" Property="Foreground" Value="Orange"/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
        <!-- Account detail template -->
        <DataTemplate x:Key="AccountDetailTemplate">
            <TextBlock>
                <Run Name="nameRun" Text="{Binding Path=login}"/>
                <Run> - test : </Run>
                <Run Name="statusRun" Text="{Binding Path=teststatus}"/>
            </TextBlock>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=teststatus}" Value="OK">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Green"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatus}" Value="KO">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Red"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatus}" Value="ARecetter">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Blue"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatus}" Value="EnCours">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Orange"/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
        <!-- Server template -->
        <HierarchicalDataTemplate x:Key="ServerTemplate" ItemsSource="{Binding Path=accounts}" ItemTemplate="{StaticResource AccountDetailTemplate}">
            <TextBlock>
                    <Run Name="nameRun" Text="{Binding Path=name}"/>
                    <Run> - Connectivity : </Run>
                    <Run Name="statusRun" Text="{Binding Path=teststatut}"/>
            </TextBlock>
            <HierarchicalDataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="OK">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Green"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="KO">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Red"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="ARecetter">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Blue"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=teststatut}" Value="EnCours">
                    <Setter TargetName="statusRun" Property="Foreground" Value="Orange"/>
                </DataTrigger>
            </HierarchicalDataTemplate.Triggers>
        </HierarchicalDataTemplate>
    </Window.Resources>
    <DockPanel Width="Auto" Height="Auto">
        <StackPanel Width="Auto" Height="31" Orientation="Horizontal" DockPanel.Dock="Bottom">
            <Label Name="StatusBarLabel" Width="155" Height="23"/>
        </StackPanel>
        <Menu Width="Auto" Height="20" DockPanel.Dock="Top">
            <MenuItem Header="File">
                <MenuItem Name="ExitMenuItem" Header="Exit" Click="ExitMenuItem_Click" />
            </MenuItem>
            <MenuItem Header="Help">
                <MenuItem Header="About"/>
            </MenuItem>
        </Menu>
        <StackPanel Width="136" Height="Auto">
            <ListBox Height="Auto" Margin="5">
                <ListBoxItem Name="ListImportListBoxItem" Selected="ListImportBoxItem_Selected">
                    <StackPanel Orientation="Horizontal">
                        <!-- <Image Source="Images\bag_black.png" /> -->
                        <TextBlock Text="List import" Width="110" Height="40" Padding="12" />
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Name="ConnectivityListBoxItem" Selected="ConnectivityBoxItem_Selected">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Connectivity" Width="110" Height="40" Padding="12" />
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Name="AccountsListBoxItem" Selected="AccountsListBoxItem_Selected">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Accounts check" Width="110" Height="40" Padding="12" />
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Name="PasswordsResetListBoxItem" Selected="PasswordsResetListBoxItem_Selected">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Passwords reset" Width="110" Height="40" Padding="12" />
                    </StackPanel>
                </ListBoxItem>
            </ListBox>
        </StackPanel>
        <StackPanel Orientation="Vertical" HorizontalAlignment="Left" Width="515" DockPanel.Dock="Right" >
            <TreeView Name="LoginPasswordTreeview" Width="Auto" Height="450" ItemsSource="{Binding Source={StaticResource ServeursList}}" ItemTemplate="{StaticResource ServerTemplate}" Margin="5" />
            <Button Name="exportButton" Content="Export report" Margin="60,5" Click="exportButton_Click" />
        </StackPanel>
        <Grid Name="ContentGrid" Width="Auto" Height="Auto" Margin="5" />
    </DockPanel>
</Window>
